<?php
/**
 * Containing all quest methods used to create charector quest
 * @author Baagoe
 */
class Quest extends XMap {
    
    //Creates charector quists and return them in JSON form
    public function createQuest($quests) {
        if(!empty($quests)) {
            foreach($quests as $quest) {
                $JSONQuists[] = $quest;
            }
            $JSONQuists = json_encode($JSONQuists);
            return $JSONQuists;
        } else {
            return null;
        }   
    }
    
    //Runs a character quiest on load
    public function showLoadingText() {
        $characterId = $this->xmlMap->attributes()->runQuest;
        if(!empty($characterId)) {
            $outputHTML = "<script type='text/javascript'>character.setStartupQuest('$characterId')</script>";
            echo $outputHTML;
        }
    }
}

?>
